package com.black.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.black.dao.WellInitParamDao;
import com.black.entity.Layer;
import com.black.entity.WellInitParam;
import com.black.service.WellInitParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: initVueProject
 * @description:
 * @author: Va1m
 * @create: 2022-03-17 15:44
 */
@Service
public class WellInitParamServiceImpl implements WellInitParamService {
    @Autowired
    WellInitParamDao wellInitParamDao;
    @Override
    public List<WellInitParam> getWellsByLayer(Integer layerNum) {
        //校验层数合法性
        if(layerNum == null || layerNum < 1){
            throw new RuntimeException("layerNum illegal!");
        }
        LambdaQueryWrapper<WellInitParam> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(WellInitParam::getLayerNum, layerNum);
        List<WellInitParam> wellInitParams = wellInitParamDao.selectList(lambdaQueryWrapper);
        return wellInitParams;
    }
}
